package com.neusoft.databus.common.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

import com.neusoft.bizcore.web.jpa.model.AbstractAuditModel;

import lombok.Getter;
import lombok.Setter;

/**
 * 监控数据
 *
 * @author naxiang
 */
@Getter
@Setter
@Entity
//@TypeDefs({ @TypeDef(name = "StringJsonObject", typeClass = StringJsonUserType.class) })
public class MonitorData extends AbstractAuditModel {

    private static final long serialVersionUID = -8275360228112343526L;

    /**
     * 监控数据
     */
    @NotBlank(message = "监控数据不能为空")
    @Lob
    @Column(columnDefinition = "text")
    //@Type(type = "StringJsonObject")
    private String data;

    /**
     * agent采集完成时间
     */
    @NotNull(message = "agent采集完成时间不能为空")
    @Column(nullable = false)
    private Date collectedTime;

    @NotNull(message = "资源不能为空")
    @ManyToOne
    @JoinColumn(name = "resource_code", referencedColumnName = "code")
    private Resource resource;

}
